"""
  模块描述：彩信报告接受服务端
  @author 8526
  @date 2022-05-16 10:08:47
  版权所有 Copyright www.dahantc.com
"""
import json

import xmltodict
from flask import Flask, request
from mms import response as res

app = Flask(__name__)


@app.route('/mmsReportReceive', methods=['POST'])
def hiddenNumCallReceive():
    status = 'success'
    try:
        mmsreport = request.form.get('mmsreport')
        data = xmltodict.parse(mmsreport)
        jsonStr = json.loads(json.dumps(data))
        print('收到报告数据：', res.mmsReportResponseDecoder(jsonStr))
    except Exception as e:
        print('数据解析异常 %s' % e)
        status = 'Failure'
    return {'status': status}


if __name__ == '__main__':
    app.run(debug=False, port=8080)
